<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{:session('cp.cpsysname')}--商户管理平台</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="{:config('webconfig.description');}">
    <meta name="keywords" content="{:config('webconfig.keywords');}">
    <meta name="author" content="runoob">
    <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/bootstrap-datetimepicker.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/index.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/Statistics.css"/>
    <script src="__STATIC_URL__/static/js/jquery-2.1.4.min.js"></script>
    <script src="__STATIC_URL__/static/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="__STATIC_URL__/static/layer/3.0.3/layer.js"></script>
    <script src="__STATIC_URL__/static/js/commen.js"></script>
    <style type="text/css">
        .red{
            color: #FF6667;
        }
        .green{
            color: #66CC99;
        }
        .persont{
            font-size: 12px;
        }
    </style>
</head>
<body>
{include file='public/header'/}
<section>
    <!------------------导航-------------------------->
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <div class="page-heading mgl15 mgr15">
            <ol class="breadcrumb">
                <li>当前位置是&nbsp;:</li>
                <li>
                    <a href="#">交易中心</a>
                </li>
                <li class="active" >交易统计</li>
            </ol>
        </div>
        <div class="mgl15 mgr15">
            <div class="panel panel-default panel-search">
                <div class="panel-heading">
                    <h5 class="panel-title"><span class="glyphicon glyphicon-search pull-left" style="margin-right: 10px;"></span>条件筛选</h5>
                </div>
                <div class="panel-body">
                    <form action="" method="get" class="form-horizontal table-search form-search" role="form" id="machform">

                        <div class="col-sm-6  col-lg-4 col-slg-4">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">时间：</label>
                                <div class="col-sm-9">
                                    <div class="input-group">
                                        <input name="starttime" type="text" value="" readonly="readonly" id="startime" placeholder="请选择" class="form-control">
                                        <div class="input-group-addon">至</div>
                                        <input name="endtime" type="text" value="" readonly="readonly" id="endtime" class="form-control" placeholder="请选择">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-6  col-lg-4 col-slg-4">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">金额：</label>
                                <div class="col-sm-9">
                                    <div class="input-group">
                                        <input name="startprice" type="text" value=""  oninput="value = value.replace(/[^\d.]/g, '')" placeholder="最低金额" class="form-control">
                                        <div class="input-group-addon">至</div>
                                        <input name="endprice" type="text" value=""  oninput="value = value.replace(/[^\d.]/g, '')" class="form-control" placeholder="最高金额">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="alert alert-success alert-dismissible mgl15 mgr15" role="alert">交易统计只统计到前一天的交易记录，当天交易不进行统计</div>
                <div class="panel-footer">
                    <a href="javascript:;" class="btn btn-primary" onclick="searchform()">查找</a>
                    <a href="javascript:;" class="btn btn-default" onclick="clearform()">清空</a>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h5 class="panel-title">
                        门店分析
                    </h5>
                </div>
                <div class="panel-body">
                    <div class="fenxilist clearfix">
                        <div class="col-sm-2">
                            <div class="card-box widget-box-1 bg-white">
                                <i class="ion-information-circled glyphicon glyphicon-info-sign	 pull-right" data-toggle="tooltip" data-placement="bottom" title data-original-title="订单的">
                                </i>
                                <h4 class="text-dark">交易笔数(笔)</h4>
                                <h2 class="text-primary text-center">
                                    <span>

                                    </span>
                                    笔
                                </h2>
                                <!--<div>-->
                                <!--<span>周同比:</span>-->
                                <!--<span class="persontnum">-0.3%</span>-->
                                <!--<span class="glyphicon persont"></span>-->
                                <!--</div>-->
                            </div>
                        </div>
                        <div class="col-sm-2">
                            <div class="card-box widget-box-1 bg-white">
                                <i class="ion-information-circled glyphicon glyphicon-info-sign	 pull-right" data-toggle="tooltip" data-placement="bottom" title data-original-title="订单的">
                                </i>
                                <h4 class="text-dark">交易金额(元)</h4>
                                <h2 class="text-pink text-center">
                                    ¥
                                    <span>

                                  </span>
                                </h2>
                                <!--<div>-->
                                <!--<span>周同比:</span>-->
                                <!--<span class="persontnum">+7.3%</span>-->
                                <!--<span class="glyphicon persont"></span>-->
                                <!--</div>-->
                            </div>
                        </div>
                        <div class="col-sm-2">
                            <div class="card-box widget-box-1 bg-white">
                                <i class="ion-information-circled glyphicon glyphicon-info-sign	 pull-right" data-toggle="tooltip" data-placement="bottom" title data-original-title="订单的">
                                </i>
                                <h4 class="text-dark">实收金额(元)</h4>
                                <h2 class="text-success  text-center">
                                    ¥
                                    <span>

                                    </span>
                                </h2>
                                <!--<div>-->
                                <!--<span>周同比:</span>-->
                                <!--<span class="persontnum">+7.3%</span>-->
                                <!--<span class="glyphicon persont"></span>-->
                                <!--</div>-->
                            </div>
                        </div>
                        <div class="col-sm-2">
                            <div class="card-box widget-box-1 bg-white">
                                <i class="ion-information-circled glyphicon glyphicon-info-sign	 pull-right" data-toggle="tooltip" data-placement="bottom" title data-original-title="订单的">
                                </i>
                                <h4 class="text-dark">单笔单价(元)</h4>
                                <h2 class="text-warning text-center">
                                    ¥
                                    <span>

                                   </span>
                                </h2>
                                <!--<div>-->
                                <!--<span>周同比:</span>-->
                                <!--<span class="persontnum">-0.3%</span>-->
                                <!--<span class="glyphicon persont"></span>-->
                                <!--</div>-->
                            </div>
                        </div>
                        <div class="col-sm-2">
                            <div class="card-box widget-box-1 bg-white">
                                <i class="ion-information-circled glyphicon glyphicon-info-sign	 pull-right" data-toggle="tooltip" data-placement="bottom" title data-original-title="订单的">
                                </i>
                                <!--<div>门店个数(个)</div>-->
                                <!--<div>$jy['zmerchant']</div>-->
                                <h4 class="text-dark">退款笔数(笔)</h4>
                                <h2 class="text-purple text-center">
                                     <span>

                                  </span>笔
                                </h2>
                                <!--<div>-->
                                <!--<span>周同比:</span>-->
                                <!--<span class="persontnum">-0.3%</span>-->
                                <!--<span class="glyphicon persont"></span>-->
                                <!--</div>-->
                            </div>
                        </div>
                        <div class="col-sm-2">
                            <div class="card-box widget-box-1 bg-white">
                                <i class="ion-information-circled glyphicon glyphicon-info-sign	 pull-right" data-toggle="tooltip" data-placement="bottom" title data-original-title="订单的">
                                </i>
                                <!--<div>交易门店数(个)</div>-->
                                <!--<div>$jy['zmerchant']</div>-->
                                <h4 class="text-dark">退款金额(元)</h4>
                                <h2 class="text-danger text-center">
                                    ¥
                                    <span>

                                </span>
                                </h2>
                                <!--<div>-->
                                <!--<span>周同比:</span>-->
                                <!--<span class="persontnum">-0.3%</span>-->
                                <!--<span class="glyphicon persont"></span>-->
                                <!--</div>-->
                            </div>
                        </div>

                    </div>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading" style="position:relative;">
                    <h5 class="panel-title">
                        门店列表
                    </h5>

                </div>
                <div class="panel-body">
                    <table class="table table-bordered" id="tableExcel">
                        <thead>
                        <tr>
                            <th>日期</th>
                            <th>门店</th>
                            <th>订单总数</th>
                            <th>销售金额</th>
                            <th>优惠金额</th>
                            <th>退款笔数</th>
                            <th>退款金额</th>
                            <th>实收金额</th>
                        </tr>
                        </thead>
                        <tbody id="daynum">

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        {include file='public/footer'/}
    </div>
</section>
</body>

<script src="__STATIC_URL__/static/js/bootstrap-datetimepicker.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    $(function () {
        var myDate = new Date();
        var hm = Date.parse(myDate)-86400000;
        $('#startime').datetimepicker({
            minView: "month", //选择日期后，不会再跳转去选择时分秒
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            autoclose: true,
            todayHighlight:true,
            endDate:new Date(hm)
        }).on('changeDate', function (ev) {
            var starttime = $('#startime').val();
            var endtime = $('#endtime').val();
            if (starttime != "" && endtime != "") {
                var startD = new Date(Date.parse(starttime.replace(/-/g, "/")));
                var endD = new Date(Date.parse(endtime.replace(/-/g, "/")));
                var days = parseInt((endD.getTime() - startD.getTime()) / (1000 * 60 * 60 * 24));
                if (days > 31) {
                    alert("日期范围应在一个月之内");
                    $('#startime').val('');
                    return false;
                };
                if (endtime < starttime) {
                    $('#startime').val('');
                    alert('开始时间必须大于结束时间');
                    return;
                };
                $("#endtime").datetimepicker('setStartDate',starttime);
                $("#starttime").datetimepicker('hide');
            }
        });
        $('#endtime').datetimepicker({
            minView: "month", //选择日期后，不会再跳转去选择时分秒
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            autoclose: true,
            todayHighlight:false,
            endDate: new Date(hm)
        }).on('changeDate', function (ev) {
            var starttime = $('#startime').val();
            var endtime = $('#endtime').val();
            if (starttime != "" && endtime != "") {
                var startD = new Date(Date.parse(starttime.replace(/-/g, "/")));
                var endD = new Date(Date.parse(endtime.replace(/-/g, "/")));
                var days = parseInt((endD.getTime() - startD.getTime()) / (1000 * 60 * 60 * 24));
                if (days > 31) {
                    alert("日期范围应在一个月之内");
                    $('#endtime').val('');
                    return false;
                };
                if (endtime < starttime) {
                    $('#endtime').val('');
                    alert('开始时间必须大于结束时间');
                    return;
                };
                $("#starttime").datetimepicker('setEndDate',endtime);
                $("#endttime").datetimepicker('hide');
            }
        });
    });
    //筛选
    function filter() {
        var ii = layer.load();
        setTimeout(function () {
            layer.close(ii);
        }, 1000);
        $("#countform").submit();

    }
    //清空筛选条件
    $(function () {
        $("#payclear").click(function () {
            $(".form-virtical input").val("");
            $(".form-virtical select").val("");
        })
    })
</script>
<script type="text/javascript">
    $(".persontnum").each(function (i) {
        var val = $(this).text();
        var type = val[0];
        if (type == "-") {
            $(this).next(".glyphicon").addClass("glyphicon-arrow-down");
            $(this).next(".glyphicon").addClass("green");
        } else if (type == "+") {
            $(this).next(".glyphicon").addClass("glyphicon-arrow-up");
            $(this).next(".glyphicon").addClass("red");
        }
    })
</script>
<script>
    $(function () {
        var mid=$("#mid").val();
        $.ajax({
            url: "{:url('paytest/machdaypaycount')}",
            type: "post",
            data: {
                mid:mid
            },
            success: function (data) {
                console.log(data);
            }
    })
    })
</script>
</html>
